package com.atbeijing.bigdata.spark.core.rdd.operator.transform;
import java.util.*;
public class Spark02_Oper_Transform_Java {
    public static void main(String[] args) {

        // 克隆的浅复制
        User user = new User();
        user.name = "zhangsan";
        ArrayList<User> users = new ArrayList<User>();
        users.add(user);

        ArrayList<User> newUsers = (ArrayList<User>)users.clone();

        System.out.println( users == newUsers );//false
        User newUser = newUsers.get(0);
        newUser.name = "lisi";

        System.out.println(user);//User[lisi]
        System.out.println(newUser);//User[lisi]

    }
}

class User {
    public String name;

    @Override
    public String toString() {
        return "User["+name+"]";
    }
}
